home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
Telnet
/
NCSA
/
tn3270 2.4d7 source
/
tn3270
/
prt.c
< prev
next >
Wrap
Text File
|
1992-04-17
|
4KB
|
147 lines
/*
* tn3270 for the Macintosh Source Code
* Brown University Computing and Information Services
* Version 2.4d7 April, 1992
* Copyright (c) 1988, 1989, 1990, 1991, 1992 by Brown University and by
* Peter John DiCamillo.
*
* Permission is granted to any individual or institution to use, copy,
* or redistribute the binary version of this software and its
* documentation provided this notice and the copyright notices are
* retained. Permission is granted to any individual or non-profit
* institution to use, copy, modify, or redistribute the source files
* of this software provided this notice and the copyright notices are
* retained. This software may not be distributed for profit, either
* in original form or in derivative works, nor can the source be
* distributed to other than an individual or a non-profit institution.
* Any individual or group interested in seeing and/or using these
* source files but who are prevented from doing so by the above
* constraints should contact Don Wolfe, Assistant Vice-President for
* Computer Systems at Brown University, (401) 863-7250, for possible
* software licensing of the source developed at Brown.
*
* Brown University and Peter John DiCamillo make no representations
* about the suitability of this software for any purpose.
*
* BROWN UNIVERSITY AND PETER JOHN DICAMILLO GIVE NO WARRANTY, EITHER
* EXPRESS OR IMPLIED, FOR THE PROGRAM AND/OR DOCUMENTATION PROVIDED,
* INCLUDING, WITHOUT LIMITATION, WARRANTY OF MERCHANTABILITY AND
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#if !defined(USEDUMP)
#include "maclib.h"
#include "termdef.h"
#include "tn3270funcs.h"
#include "globals.h"
#else
#pragma load "tn3270DumpFile"
#endif
#pragma segment vmxfer
void pgsetup(void)
{
if (hPrint == 0) {
SysBeep(1);
return;
}
if (prtinit == 0) {
PrOpen();
if (PrError() != noErr) {
SysBeep(1);
return;
}
PrintDefault(hPrint);
prtinit = 1;
}
PrValidate(hPrint); /* in case user changed print drivers */
PrStlDialog(hPrint);
}
void prscreen(cnr *cp)
{
TPPrPort prtport;
GrafPtr gp;
TPrStatus prStatus;
if (hPrint == 0) {
SysBeep(1);
return;
}
if (prtinit == 0) {
PrOpen();
if (PrError() != noErr) {
SysBeep(1);
return;
}
PrintDefault(hPrint);
prtinit = 1;
}
PrValidate(hPrint); /* in case user changed print drivers */
arrowcursor();
if (!PrJobDialog(hPrint)) return;
/* main printing code (not loop, since only one page) */
GetPort(&gp);
setdoctitle("3270 Screen Dump");
prtport = PrOpenDoc(hPrint, 0L, 0L);
if (PrError() == noErr) {
PrOpenPage(prtport, 0L); /* start new page */
if (PrError() == noErr) prtdraw(cp);
PrClosePage(prtport);
}
PrCloseDoc(prtport);
if (((*hPrint)->prJob.bJDocLoop == bSpoolLoop) && (PrError() == noErr))
PrPicFile(hPrint, 0L, 0L, 0L, &prStatus);
if (PrError() != noErr) stoperr(305, cp);
SetPort(gp);
}
void prtdraw(cnr *cp)
{
char colorsave;
GrafPtr gp;
TextFont(cp->stdfont);
PicComment(155, 0, 0L); /* line layout off */
/* set constants for 12-point, and if page is not big enough,
use 9-point instead */
setmode(cp->cur_rows, cp->cur_cols, 12, 0, cp);
TextSize(12);
GetPort(&gp);
if ((cp->hpixsize > (gp->portRect).right) ||
(cp->vpixsize > (gp->portRect).bottom)) {
setmode(cp->cur_rows, cp->cur_cols, 9, 0, cp);
TextSize(9);
}
/* set colormac flag according to printing grafport */
colorsave = colormac;
colormac = ((gp->portBits.rowBytes & 0xc000) == 0xc000);
writescr(1, cp);
/* restore settings by calling setmode */
setmode(cp->cur_rows, cp->cur_cols, cp->cur_ptsize, cp->cs.windmax, cp);
/* restore colormac flag */
colormac = colorsave;
}
void setdoctitle(unsigned char *s)
{
WindowPtr wp;
unsigned char titlesave[256];
wp = FrontWindow();
if (wp == 0) return;
GetWTitle(wp, titlesave);
c2pstr(s);
SetWTitle(wp, s);
p2cstr(s);
PrValidate(hPrint);
SetWTitle(wp, titlesave);
}